#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <aclconio.h>
#include <define.h>
#include <transact.h>
#include <tran.h>
#include <gds.h>
#include <sizes.h>
#include "ConfProto.h"
#include "tblutil.h"
#include <\SOFTPAY\Ver30\source\include\sizes.h>
#include <\SOFTPAY\Ver30\HostSrc\citisrc\citiids.h>
#include <\SOFTPAY\Ver30\HostSrc\cpacsrc\cpacids.h>
#include <confio.h>

#include <\SOFTPAY\Ver30\source\include\BDT.h>

const char*BDTName = "BDT.dat";

static BDT_REC srBDTRec;

static int recordNum;
int	inLoadBDTRec (int inRecNumber)
{
	int inRet;

	inRet = inLoadConfRec(BDT_FILENAME, SIZE_BDT_REC, inRecNumber, (char *) &srBDTRec);

	recordNum = inRecNumber;
	return inRet;
}

void *pvdGetBDTRec(void)
{
	return &srBDTRec;

}

int	inSaveBDTRec (int inRecNumber)
{
	int inRet;

	inRet = inSaveConfRec(BDT_FILENAME, SIZE_BDT_REC, inRecNumber, (char *) &srBDTRec);

	return inRet;
}

int	inGetBDTRecNumber (void)
{
	return recordNum;
}

int	inUpdateBDTRec (void)
{
	int inRet;

	inRet = inSaveConfRec(BDT_FILENAME, SIZE_BDT_REC, recordNum, (char *) &srBDTRec);

	return inRet;
}

void	vdResetBDTRec (void)
{
	memset((void*)&srBDTRec, 0, REC_SIZEOF(srBDTRec));
}

long lnGetNbrOfTransactions(void)
{
	return srBDTRec.lnNbrOfTransactions;
}

void vdSetNbrOfTransactions(long lnNbrOfTransactions)
{
	srBDTRec.lnNbrOfTransactions = lnNbrOfTransactions;
}

short inGetBatchNumSize(void)
{
	return srBDTRec.inBatchNumSize;
}

void vdSetBatchNumSize(short inBatchNumSize)
{
	srBDTRec.inBatchNumSize = inBatchNumSize;
}

short inGetBatchNumLimit(void)
{
	return srBDTRec.inBatchNumLimit;
}

void vdSetBatchNumLimit(short inBatchNumLimit)
{
	srBDTRec.inBatchNumLimit = inBatchNumLimit;
}

char* szGetLastTransactionDate(void)
{
	return srBDTRec.szLastTransactionDate;
}

void vdSetLastTransactionDate(const char* szLastTransactionDate)
{
	strNumCopy(srBDTRec.szLastTransactionDate, szLastTransactionDate, sizeof(((BDT_REC*)NULL)->szLastTransactionDate)-1);
}

char* szGetLastTransactionTime(void)
{
	return srBDTRec.szLastTransactionTime;
}

void vdSetLastTransactionTime(const char* szLastTransactionTime)
{
	strNumCopy(srBDTRec.szLastTransactionTime, szLastTransactionTime, sizeof(((BDT_REC*)NULL)->szLastTransactionTime)-1);
}

long lnGetNbrOfOfflineTran(void)
{
	return srBDTRec.lnNbrOfOfflineTran;
}

void vdSetNbrOfOfflineTran(long lnNbrOfOfflineTran)
{
	srBDTRec.lnNbrOfOfflineTran = lnNbrOfOfflineTran;
}

VS_BOOL fGetBDTCustomBit1(void)
{
	return srBDTRec.fBDTCustomBit1;
}

void vdSetBDTCustomBit1(VS_BOOL fBDTCustomBit1)
{
	srBDTRec.fBDTCustomBit1 = fBDTCustomBit1;
}

VS_BOOL fGetBDTCustomBit2(void)
{
	return srBDTRec.fBDTCustomBit2;
}

void vdSetBDTCustomBit2(VS_BOOL fBDTCustomBit2)
{
	srBDTRec.fBDTCustomBit2 = fBDTCustomBit2;
}

VS_BOOL fGetBDTCustomBit3(void)
{
	return srBDTRec.fBDTCustomBit3;
}

void vdSetBDTCustomBit3(VS_BOOL fBDTCustomBit3)
{
	srBDTRec.fBDTCustomBit3 = fBDTCustomBit3;
}

VS_BOOL fGetBDTCustomBit4(void)
{
	return srBDTRec.fBDTCustomBit4;
}

void vdSetBDTCustomBit4(VS_BOOL fBDTCustomBit4)
{
	srBDTRec.fBDTCustomBit4 = fBDTCustomBit4;
}

VS_BOOL fGetDoNotUploadOfflinePairTransVoid(void)
{
	return srBDTRec.fDoNotUploadOfflinePairTransVoid;
}

void vdSetDoNotUploadOfflinePairTransVoid(VS_BOOL fDoNotUploadOfflinePairTransVoid)
{
	srBDTRec.fDoNotUploadOfflinePairTransVoid = fDoNotUploadOfflinePairTransVoid;
}

VS_BOOL fGetTipAsANewRegisterInBatch(void)
{
	return srBDTRec.fTipAsANewRegisterInBatch;
}

void vdSetTipAsANewRegisterInBatch(VS_BOOL fTipAsANewRegisterInBatch)
{
	srBDTRec.fTipAsANewRegisterInBatch = fTipAsANewRegisterInBatch;
}

VS_BOOL fGetAllTransAsANewRegisterInBatch(void)
{
	return srBDTRec.fAllTransAsANewRegisterInBatch;
}

void vdSetAllTransAsANewRegisterInBatch(VS_BOOL fAllTransAsANewRegisterInBatch)
{
	srBDTRec.fAllTransAsANewRegisterInBatch = fAllTransAsANewRegisterInBatch;
}

VS_BOOL fGetStoreTrack1(void)
{
	return srBDTRec.fStoreTrack1;
}

void vdSetStoreTrack1(VS_BOOL fStoreTrack1)
{
	srBDTRec.fStoreTrack1 = fStoreTrack1;
}

VS_BOOL fGetStoreTrack2(void)
{
	return srBDTRec.fStoreTrack2;
}

void vdSetStoreTrack2(VS_BOOL fStoreTrack2)
{
	srBDTRec.fStoreTrack2 = fStoreTrack2;
}

VS_BOOL fGetStoreCustName(void)
{
	return srBDTRec.fStoreCustName;
}

void vdSetStoreCustName(VS_BOOL fStoreCustName)
{
	srBDTRec.fStoreCustName = fStoreCustName;
}

